home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0043_VGA Fonts from file.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  3KB  |  70 lines

  1. {
  2.   Sean Palmer
  3.  
  4. > Does anyone know of any way to display a single screen of Graphics on
  5. > EGA 640x350 mode *quickly*.  It can be VGA as well; I'm just trying to
  6. > display the screen *fast* from a disk File.  I know, I could have used
  7. > the GIF or PCX format (or any other format), but I want to make a
  8. > proprietary format to deter hacking of the picture.  So, what I want to
  9. > know is how to read the data from disk directly to screen.  I've
  10. > figured out that BlockRead (if I can get it to work) is the best method
  11. > of reading the data from the disk, but I don't know of any fast, and I
  12. > mean *fast*, methods of writing the data to the screen.  Would it be
  13. > feasible to use an Array the size of the screen and Move the Array to
  14. > the screen (I'd need memory locations For that, if possible)?  Any
  15. > response (ideas, solutions, code fragments) would be appreciated.
  16.  
  17. You could set up the screen as an Absolute Variable.
  18. Then read in each plane as an Array DIRECTLY from the disk File.
  19. Before reading each plane, set up Write mode 0 (should be already in mode 0)
  20. and make sure that the enable set/reset register is set to 0 so that the cpu
  21. Writes go directly to the planes. Set the sequencer map mask register for
  22. each plane so you only Write to them one at a time. and enable the entire Bit
  23. Mask register ($0F). Then after telling it which plane, read directly from
  24. the File. No I haven't tested the following code and most of it's gonna be
  25. from memory but give it a try:
  26.  
  27. the File:
  28.   Plane 0
  29.   Plane 1
  30.   Plane 2
  31.   Plane 3
  32.  
  33. each Plane:
  34.   350 rows of 80 Bytes (each bit belongs to a different pixel)
  35. }
  36.  
  37. Type
  38.   scrRec = Array[0..640 * 350 div 8 - 1] of Byte;
  39. Var
  40.   screen : scrRec Absolute $A000 : 0000;
  41.   dFile  : File of scrRec;
  42.  
  43. Const
  44.   gcPort  = $3CE;  {EGA/VGA Graphics controller port}
  45.   seqPort = $3C4;  {EGA/VGA sequencer port}
  46.  
  47. Procedure readFileToMode10h(s:String);
  48. Var
  49.   dFile : File of scrRec;
  50.   i     : Byte;
  51. begin
  52.   Asm
  53.     mov ax, $10;
  54.     int $10;
  55.   end;  {set up video mode}
  56.   assign (dFile,s);
  57.   reset(s);  {no error checking 8) }
  58.   portw[gcPort] := $0001;    {clear enable set/reset reg}
  59.   portw[gcPort] := $FF08;    {set entire bit mask (this is the default?)}
  60.   For i := 0 to 3 do
  61.   begin
  62.    {set map mask reg to correct plane}
  63.    portw[seqPort] := (1 shl (i + 8)) + $02;
  64.    read(dFile, screen); {load that plane in}
  65.   end;
  66.   portw[seqPort] := $0F02;   {restore stuff to normal}
  67.   portw[gcPort]  := $0F01;
  68.   close(dFile);
  69. end;
  70.